import { _decorator, Button, Component } from 'cc';
import { Databus } from '../core/Databus';
import { UniformFunction } from '../platform/UniformFunction';
import { PlatformSetting } from '../platform/PlatformSetting';
import { MatrixCustomMultiAd } from '../platform/ad/MatrixCustomMultiAd';
import { WxSdkManager } from '../platform/ad/WxSdkManager';

const { ccclass, property } = _decorator;

const databus = Databus.Instance();
@ccclass('MoreGamePage')
export class MoreGamePage extends Component {
  public backButton: Button = null;
  public douziButton: Button = null;
  public tankButton: Button = null;
  
  public xiaoButton: Button = null;
  public qingluButton: Button = null;
  public wanButton: Button = null;
  public daButton: Button = null;
  public qinButton: Button = null;
  public yanButton: Button = null;
  
  

  protected onEnable(): void {
   // console.log("555555555555555")
    WxSdkManager.toggleCustomCol33Ad(true)
  }

  protected onDisable(): void {
  //  console.log("777777777777777777")
    WxSdkManager.toggleCustomCol33Ad(false)
  }


  public onLoad(): void {
    this.backButton = this.node.getChildByName('BackHome').getComponent(Button);
    this.douziButton = this.node.getChildByName('DouZiButton').getComponent(Button);
    this.tankButton = this.node.getChildByName('TankButton').getComponent(Button);
	
	
	
	
	this.xiaoButton = this.node.getChildByName('XiaoButton').getComponent(Button);
	this.qingluButton = this.node.getChildByName('QingluButton').getComponent(Button);
	this.wanButton = this.node.getChildByName('WanButton').getComponent(Button);
	this.daButton = this.node.getChildByName('DaButton').getComponent(Button);
	this.qinButton = this.node.getChildByName('QinButton').getComponent(Button);
	this.yanButton = this.node.getChildByName('YanButton').getComponent(Button);
	
	
    this.backButton.node.on(Button.EventType.CLICK, this.backPage, this);
    this.douziButton.node.on(Button.EventType.CLICK, this.toDouZiXiangQi, this);
    this.tankButton.node.on(Button.EventType.CLICK, this.toTank, this)
	
	
	
	this.xiaoButton.node.on(Button.EventType.CLICK, this.xiaoButtonclick, this);
	this.qingluButton.node.on(Button.EventType.CLICK, this.qingluButtonclick, this);
	this.wanButton.node.on(Button.EventType.CLICK, this.wanButtonclick, this)
	this.daButton.node.on(Button.EventType.CLICK, this.daButtonclick, this);
	this.qinButton.node.on(Button.EventType.CLICK, this.qinButtonclick, this);
	this.yanButton.node.on(Button.EventType.CLICK, this.yanButtonclick, this)

	
  }
  public start() {
    MatrixCustomMultiAd.Instance().show();
  }
  public update(deltaTime: number) {
  }
  
  
  
  public yanButtonclick() {
    if (PlatformSetting.isByteDance()) {
      new UniformFunction().showInfoToast("敬请期待", 2000);
      return;
    }
    new UniformFunction().navigateToyanButton();
  }
  
  
  public qinButtonclick() {
    if (PlatformSetting.isByteDance()) {
      new UniformFunction().showInfoToast("敬请期待", 2000);
      return;
    }
    new UniformFunction().navigateToqinButton();
  }
  
  
  public daButtonclick() {
    if (PlatformSetting.isByteDance()) {
      new UniformFunction().showInfoToast("敬请期待", 2000);
      return;
    }
    new UniformFunction().navigateTodaButton();
  }
  
  
  public wanButtonclick() {
    if (PlatformSetting.isByteDance()) {
      new UniformFunction().showInfoToast("敬请期待", 2000);
      return;
    }
    new UniformFunction().navigateTowanButton();
  }
  
  public qingluButtonclick() {
    if (PlatformSetting.isByteDance()) {
      new UniformFunction().showInfoToast("敬请期待", 2000);
      return;
    }
    new UniformFunction().navigateToqingluButton();
  }
  
  public xiaoButtonclick() {
    if (PlatformSetting.isByteDance()) {
      new UniformFunction().showInfoToast("敬请期待", 2000);
      return;
    }
    new UniformFunction().navigateToxiaoButton();
  }
  
  
  
  
  
  
  
  
  
  
  

  public backPage() {
    MatrixCustomMultiAd.Instance().hide();
    databus.sceneStack.backScene();
  }

  public toDouZiXiangQi() {
    if (PlatformSetting.isByteDance()) {
      new UniformFunction().showInfoToast("敬请期待", 2000);
      return;
    }
    new UniformFunction().navigateToDouZiXiangQi();
  }

  public toTank() {
    if (PlatformSetting.isByteDance()) {
      new UniformFunction().showInfoToast("敬请期待", 2000);
      return;
    }
    new UniformFunction().navigateToTank();
  }
}